using System;
using OpenFlashChartLib.Json;

namespace OpenFlashChartLib.Charts
{
    public class PieValue : ILabelValue
    {
        public PieValue()
        {
        }

        public PieValue(double val)
        {
            Value = val;
        }

        public PieValue(double val, string text)
        {
            Value = val;
            Label = text;
        }

        [JsonProperty("value")]
        public double Value { get; set; }

        [JsonProperty("label")]
        public string Label { get; set; }

        public static implicit operator PieValue(double val)
        {
            return new PieValue(val, "");
        }

        public int CompareTo(PieValue other)
        {
            return Value.CompareTo(other.Value);
        }
    }
}